LastModified, Bookmark Properties Example

This example illustrates use of the LastModified property to reposition the current row pointer to the row most recently modified by RDO. The code opens a connection against SQL Server and creates a keyset cursor-based query on the Authors table. The query expects a single parameter to pass in the name of the Author to edit. Once selected, edited and updated, the row pointer is repositioned to the last row modified by setting the bookmark property of the rdoResultset to the LastModified property.

Option Explicit
Dim er As rdoError
Dim cn As New rdoConnection
Dim qy As New rdoQuery
Dim rs As rdoResultset
Dim col As rdoColumn

Private Sub TestLM_Click()
qy(0) = LookFor.Text

rs.Edit
rs!City = NewCity.Text   ' a TextBox control
rs.Update

rs.Bookmark = rs.LastModified

'Simply show data in picture control
Pic.Cls   'Clear the picture control.

For Each col In rs.rdoColumns
    Pic.Print col.Name,   
Next
Pic.Print String(80, "-")
For Each col In rs.rdoColumns
    Pic.Print col,
Next

End Sub

Private Sub Form_Load()
cn.CursorDriver = rdUseOdbc
cn.Connect = "uid=;pwd=;server=sequel;" _
   & "driver={SQL Server};database=pubs;dsn='';"
cn.EstablishConnection

With qy
    .Name = "ShowWhite"
    .SQL = "Select * from Authors " _
      & " where Au_LName like ?"
    .LockType = rdConcurReadOnly
    .CursorType = rdOpenForwardOnly
    .RowsetSize = 1
    Set .ActiveConnection = cn
End With

qy(0) = LookFor.Text      ' a textbox control
Set rs = qy.OpenResultset(rdOpenKeyset, rdConcurRowver)

Exit Sub
End Sub